/*     */ import java.awt.Color;
/*     */ import java.awt.Container;
/*     */ import java.awt.Dimension;
/*     */ import java.awt.Font;
/*     */ import java.awt.Graphics;
/*     */ import java.awt.Graphics2D;
/*     */ import java.awt.Insets;
/*     */ import java.awt.event.ActionEvent;
/*     */ import java.awt.event.ActionListener;
/*     */ import java.awt.event.MouseEvent;
/*     */ import java.awt.event.MouseMotionListener;
import java.awt.geom.Line2D;
/*     */ import java.awt.geom.Line2D.Double;
/*     */ import java.text.DecimalFormat;
/*     */ import java.util.Arrays;
/*     */ import java.util.List;
/*     */ import javax.swing.BorderFactory;
/*     */ import javax.swing.Box;
/*     */ import javax.swing.BoxLayout;
/*     */ import javax.swing.JButton;
/*     */ import javax.swing.JDialog;
/*     */ import javax.swing.JFrame;
/*     */ import javax.swing.JLabel;
/*     */ import javax.swing.JOptionPane;
/*     */ import javax.swing.JPanel;
/*     */ import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
/*     */ 
/*     */ public class WRChart extends JPanel
/*     */   implements MouseMotionListener, BBIInterface, ActionListener
/*     */ {
/*     */   private SymQuotes sq;
/*     */   private String sym;
/*  14 */   private float yScale = 1.0F;
/*  15 */   private float xScale = 1.0F;
/*     */   private double stickWidth;
/*     */   private float minVal;
/*     */   private float maxVal;
/*     */   private int parm1;
/*     */   private float[] wr_parm1;
/*  20 */   private String trend = "";
/*  21 */   private String m = "";
/*     */   private int mX;
/*     */   private int mY;
/*  23 */   public int noOfDays = 150;
/*     */   private double p1Y;
/*     */   private double p2Y;
/*     */   private JTextField parm1TF;
/*     */   private JButton chgParmOk;
/*     */   private JButton chgParmCancel;
/*     */   private JButton defaultParms;
/*     */   private JDialog chgParmDialog;
/*  31 */   private DecimalFormat df = new DecimalFormat("0.00");
/*     */ 
/*  33 */   private boolean c = true;
/*     */   public WRChart.EastPanel ep;
/*     */   private double refY;
/*     */   private double refX;
/* 451 */   private Font ssp10 = new Font("SansSerif", 0, 10);
/* 452 */   private Font ssp9 = new Font("SansSerif", 0, 9);
/* 453 */   private Line2D.Double refL1 = new Line2D.Double();
/* 454 */   private Line2D.Double refL2 = new Line2D.Double();
/* 455 */   private Line2D.Double gridY = new Line2D.Double();
/* 456 */   private Line2D.Double gridX = new Line2D.Double();
/* 457 */   private Line2D.Double yrefL1 = new Line2D.Double();
/* 458 */   private Line2D.Double yrefL2 = new Line2D.Double();
/*     */   private double yfactor;
/*     */   private double startPointX;
/*     */   private int dateRef;
/*     */   private int daysRef;
/* 463 */   private Line2D.Double l2 = new Line2D.Double();
/*     */   private double x1;
/*     */   private double y1;
/*     */   private double x2;
/*     */   private double y2;
/*     */   private double u1;
/*     */   private double v1;
/*     */   private double u2;
/*     */   private double v2;
/*     */   private double a1;
/*     */   private double b1;
/*     */   private double a2;
/*     */   private double b2;
/*     */   private double xi;
/*     */   private double yi;
/* 465 */   private Line2D.Double uA = new Line2D.Double();
/* 466 */   private Line2D.Double lA = new Line2D.Double();
/* 467 */   private Line2D.Double hA = new Line2D.Double();
/*     */ 
/*     */   public WRChart(SymQuotes paramSymQuotes, int paramInt)
/*     */   {
/*  39 */     this.sq = paramSymQuotes;
/*  40 */     this.sym = paramSymQuotes.sym;
/*     */ 
/*  42 */     this.wr_parm1 = new float[paramSymQuotes.count];
/*     */ 
/*  44 */     this.parm1 = paramInt;
/*     */ 
/*  46 */     if (this.noOfDays == 150)
/*  47 */       this.stickWidth = (4.0F * this.xScale);
/*     */     else {
/*  49 */       this.stickWidth = (1.5D * this.xScale);
/*     */     }
/*  51 */     setBackground(Color.black);
/*  52 */     setPreferredSize(new Dimension((int)(750.0F * this.xScale + 100.0F), (int)(100.0F * this.yScale + 25.0F)));
/*     */ 
/*  54 */     if (paramInt < paramSymQuotes.count) {
/*  55 */       wr_parm1Finder();
/*     */     }
/*  57 */     this.minVal = -100.0F;
/*  58 */     this.maxVal = 0.0F;
/*  59 */     findTrend();
/*  60 */     addMouseMotionListener(this);
/*     */ 
/*  62 */     this.ep = new WRChart.EastPanel();
/*     */   }
/*     */ 
/*     */   public void changeNoOfDays(int paramInt)
/*     */   {
/*  69 */     this.noOfDays = paramInt;
/*     */ 
/*  71 */     if (paramInt == 150)
/*  72 */       this.stickWidth = (4.0F * this.xScale);
/*     */     else
/*  74 */       this.stickWidth = (1.5D * this.xScale);
/*     */   }
/*     */ 
/*     */   public int getBBIdata(int paramInt)
/*     */   {
/*  81 */     if (this.wr_parm1[paramInt] > -20.0F) {
/*  82 */       return 1;
/*     */     }
/*     */ 
/*  85 */     if (this.wr_parm1[paramInt] < -80.0F) {
/*  86 */       return 0;
/*     */     }
/*     */ 
/*  89 */     if ((this.wr_parm1[paramInt] >= -80.0F) && (this.wr_parm1[paramInt] <= -20.0F))
/*     */     {
/*  91 */       for (int i = paramInt - 1; i > 10; i--)
/*     */       {
/*  93 */         if (this.wr_parm1[i] < -80.0F) {
/*  94 */           return 1;
/*     */         }
/*     */ 
/*  97 */         if (this.wr_parm1[i] > -20.0F) {
/*  98 */           return 0;
/*     */         }
/*     */       }
/*     */     }
/*     */ 
/* 103 */     return 0;
/*     */   }
/*     */ 
/*     */   public void redrawChart(SymQuotes paramSymQuotes)
/*     */   {
/* 110 */     this.sq = paramSymQuotes;
/* 111 */     this.sym = paramSymQuotes.sym;
/*     */ 
/* 113 */     this.wr_parm1 = new float[paramSymQuotes.count];
/*     */ 
/* 115 */     if (this.noOfDays == 150)
/* 116 */       this.stickWidth = (4.0F * this.xScale);
/*     */     else {
/* 118 */       this.stickWidth = (1.5D * this.xScale);
/*     */     }
/* 120 */     if (this.parm1 < paramSymQuotes.count) {
/* 121 */       wr_parm1Finder();
/*     */     }
/* 123 */     this.minVal = -100.0F;
/* 124 */     this.maxVal = 0.0F;
/* 125 */     findTrend();
/*     */ 
/* 127 */     repaint();
/* 128 */     this.ep.updateValues();
/*     */   }
/*     */ 
/*     */   public void redrawChart()
/*     */   {
/* 135 */     Arrays.fill(this.wr_parm1, 0.0F);
/*     */ 
/* 137 */     if (this.parm1 < this.sq.count) {
/* 138 */       wr_parm1Finder();
/*     */     }
/* 140 */     this.minVal = -100.0F;
/* 141 */     this.maxVal = 0.0F;
/* 142 */     findTrend();
/*     */ 
/* 144 */     repaint();
/* 145 */     this.ep.updateValues();
/*     */   }
/*     */ 
/*     */   public void mouseMoved(MouseEvent paramMouseEvent)
/*     */   {
/* 153 */     int j = 1;
/* 154 */     if ((paramMouseEvent.getX() >= 50) && (paramMouseEvent.getX() <= 750.0F * this.xScale + 50.0F) && (paramMouseEvent.getY() >= 10) && (paramMouseEvent.getY() <= this.yScale * 100.0F + 10.0F))
/*     */     {
/* 156 */       int i = (int)((750.0F * this.xScale - (paramMouseEvent.getX() - 50) - this.stickWidth / 2.0D) / (this.stickWidth + 1.0F * this.xScale));
/*     */ 
/* 158 */       if (this.sq.count - 1 >= i)
/*     */       {
/* 160 */         j = this.sq.count - 1 - i;
/* 161 */         this.m = ("( " + (String)this.sq.date.get(j) + "WMS[" + this.parm1 + "]:" + this.df.format(this.wr_parm1[j]) + " )");
/* 162 */         this.mX = paramMouseEvent.getX();
/* 163 */         this.mY = paramMouseEvent.getY();
/* 164 */         repaint();
/* 165 */         return;
/*     */       }
/*     */ 
/* 169 */       this.m = "";
/*     */ 
/* 171 */       repaint();
/* 172 */       return;
/*     */     }
/*     */ 
/* 176 */     this.m = "";
/* 177 */     repaint();
/*     */   }
/*     */ 
/*     */   public void mouseDragged(MouseEvent paramMouseEvent)
/*     */   {
/*     */   }
/*     */ 
/*     */   private void drawValues(Graphics2D paramGraphics2D)
/*     */   {
/* 190 */     paramGraphics2D.setPaint(Color.cyan);
/*     */ 
/* 192 */     if (this.mX + this.m.length() * 5 > 750.0F * this.xScale + 50.0F) {
/* 193 */       this.mX -= this.m.length() * 5;
/*     */     }
/* 195 */     paramGraphics2D.drawString(this.m, this.mX, this.mY);
/*     */   }
/*     */ 
/*     */   private void wr_parm1Finder()
/*     */   {
/* 202 */     for (int i = 0; i < this.parm1; i++) {
/* 203 */       this.wr_parm1[i] = 0.0F;
/*     */     }
/* 205 */     for (int i = this.parm1; i < this.sq.count; i++)
/*     */     {
/* 207 */       float f1 = ((Float)this.sq.high.get(i)).floatValue();
/* 208 */       float f2 = ((Float)this.sq.low.get(i)).floatValue();
/* 209 */       for (int j = i - 1; j > i - this.parm1; j--)
/*     */       {
/* 211 */         if (f1 < ((Float)this.sq.high.get(j)).floatValue())
/*     */         {
/* 213 */           f1 = ((Float)this.sq.high.get(j)).floatValue();
/*     */         }
/* 215 */         if (f2 <= ((Float)this.sq.low.get(j)).floatValue())
/*     */           continue;
/* 217 */         f2 = ((Float)this.sq.low.get(j)).floatValue();
/*     */       }
/*     */ 
/* 221 */       this.wr_parm1[i] = ((f1 - ((Float)this.sq.close.get(i)).floatValue()) / (f1 - f2) * -100.0F);
/*     */     }
/*     */   }
/*     */ 
/*     */   public void updateParms(int paramInt)
/*     */   {
/* 229 */     this.parm1 = paramInt;
/*     */ 
/* 231 */     wr_parm1Finder();
/*     */   }
/*     */ 
/*     */   public Box getWRBox(boolean paramBoolean)
/*     */   {
/* 238 */     Box localBox = Box.createHorizontalBox();
/* 239 */     TitledBorder localTitledBorder = BorderFactory.createTitledBorder("William's %R");
/*     */ 
/* 241 */     this.parm1TF = new JTextField("" + this.parm1, 2);
/* 242 */     this.parm1TF.setFont(this.ssp10);
/* 243 */     this.parm1TF.setMaximumSize(new Dimension(25, 20));
/*     */ 
/* 245 */     JLabel localJLabel1 = new JLabel("WMS[");
/* 246 */     JLabel localJLabel2 = new JLabel("]     ");
/*     */ 
/* 248 */     localJLabel1.setFont(this.ssp10);
/* 249 */     localJLabel2.setFont(this.ssp10);
/*     */ 
/* 251 */     localBox.add(localJLabel1);
/* 252 */     localBox.add(this.parm1TF);
/* 253 */     localBox.add(localJLabel2);
/*     */ 
/* 255 */     localBox.add(Box.createHorizontalGlue());
/*     */ 
/* 257 */     if (paramBoolean) {
/* 258 */       localBox.setBorder(localTitledBorder);
/*     */     }
/* 260 */     return localBox;
/*     */   }
/*     */ 
/*     */   public void showChgParmDialog()
/*     */   {
/* 267 */     JFrame localJFrame = new JFrame();
/* 268 */     this.chgParmDialog = new JDialog(localJFrame, "Change William's %R Parameters", true);
/* 269 */     Box localBox1 = Box.createVerticalBox();
/* 270 */     Box localBox2 = Box.createHorizontalBox();
/*     */ 
/* 272 */     this.chgParmOk = new JButton("OK");
/* 273 */     this.chgParmOk.setFont(this.ssp10);
/* 274 */     this.chgParmOk.setMargin(new Insets(1, 2, 1, 2));
/* 275 */     this.chgParmOk.addActionListener(this);
/*     */ 
/* 277 */     this.chgParmCancel = new JButton("Cancel");
/* 278 */     this.chgParmCancel.setFont(this.ssp10);
/* 279 */     this.chgParmCancel.setMargin(new Insets(1, 2, 1, 2));
/* 280 */     this.chgParmCancel.addActionListener(this);
/*     */ 
/* 282 */     this.defaultParms = new JButton("Default");
/* 283 */     this.defaultParms.setFont(this.ssp10);
/* 284 */     this.defaultParms.setMargin(new Insets(1, 2, 1, 2));
/* 285 */     this.defaultParms.setToolTipText("Reset to default parameters");
/* 286 */     this.defaultParms.addActionListener(this);
/*     */ 
/* 288 */     localBox2.add(Box.createHorizontalGlue());
/* 289 */     localBox2.add(this.chgParmOk);
/* 290 */     localBox2.add(Box.createHorizontalStrut(5));
/* 291 */     localBox2.add(this.chgParmCancel);
/* 292 */     localBox2.add(Box.createHorizontalStrut(5));
/* 293 */     localBox2.add(this.defaultParms);
/* 294 */     localBox2.add(Box.createHorizontalGlue());
/*     */ 
/* 296 */     localBox1.add(getWRBox(true));
/* 297 */     localBox1.add(localBox2);
/*     */ 
/* 299 */     this.chgParmDialog.getContentPane().add(localBox1);
/* 300 */     this.chgParmDialog.setSize(250, 100);
/* 301 */     this.chgParmDialog.setLocationRelativeTo(this.ep);
/* 302 */     this.chgParmDialog.setVisible(true);
/*     */   }
/*     */ 
/*     */   public boolean validateParm()
/*     */   {
/* 309 */     int i = this.parm1;
/*     */     try
/*     */     {
/* 313 */       i = Integer.parseInt(this.parm1TF.getText().trim());
/*     */     }
/*     */     catch (NumberFormatException localNumberFormatException)
/*     */     {
/* 319 */       JOptionPane.showMessageDialog(null, "Error in William's %R parameter.Enter only numbers greater than 2.", null, 0);
/*     */ 
/* 322 */       this.parm1TF.setText("" + this.parm1);
/*     */ 
/* 324 */       return false;
/*     */     }
/*     */ 
/* 328 */     if (i > 200)
/*     */     {
/* 330 */       JOptionPane.showMessageDialog(null, "Error in William's %R parameter.Enter values between 2 and 200.", null, 0);
/*     */ 
/* 333 */       this.parm1TF.setText("" + this.parm1);
/*     */ 
/* 335 */       return false;
/*     */     }
/*     */ 
/* 339 */     if (i < 2)
/*     */     {
/* 341 */       JOptionPane.showMessageDialog(null, "Error in William's %R parameter.Enter values between 2 and 200.", null, 0);
/*     */ 
/* 344 */       this.parm1TF.setText("" + this.parm1);
/*     */ 
/* 346 */       return false;
/*     */     }
/*     */ 
/* 350 */     this.parm1 = i;
/*     */ 
/* 352 */     return true;
/*     */   }
/*     */ 
/*     */   public void actionPerformed(ActionEvent paramActionEvent)
/*     */   {
/* 359 */     if (paramActionEvent.getSource() == this.chgParmOk)
/*     */     {
/* 361 */       if (!validateParm()) {
/* 362 */         return;
/*     */       }
/* 364 */       redrawChart();
/* 365 */       this.chgParmDialog.dispose();
/*     */     }
/*     */ 
/* 369 */     if (paramActionEvent.getSource() == this.chgParmCancel)
/*     */     {
/* 371 */       this.chgParmDialog.dispose();
/*     */     }
/*     */ 
/* 375 */     if (paramActionEvent.getSource() == this.defaultParms)
/*     */     {
/* 377 */       setDefaultParms();
/*     */     }
/*     */   }
/*     */ 
/*     */   public void setDefaultParms()
/*     */   {
/* 386 */     this.parm1TF.setText("10");
/*     */   }
/*     */ 
/*     */   public void vZoom(boolean paramBoolean)
/*     */   {
/* 393 */     if (paramBoolean)
/* 394 */       this.yScale += 0.2F;
/* 395 */     else if (this.yScale >= 1.2F) {
/* 396 */       this.yScale -= 0.2F;
/*     */     }
/* 398 */     setPreferredSize(new Dimension((int)(750.0F * this.xScale + 100.0F), (int)(100.0F * this.yScale + 25.0F)));
/*     */   }
/*     */ 
/*     */   public void hZoom(boolean paramBoolean)
/*     */   {
/* 405 */     if (paramBoolean)
/* 406 */       this.xScale += 0.2F;
/* 407 */     else if (this.xScale >= 1.2F) {
/* 408 */       this.xScale -= 0.2F;
/*     */     }
/* 410 */     if (this.noOfDays == 150)
/* 411 */       this.stickWidth = (4.0F * this.xScale);
/*     */     else
/* 413 */       this.stickWidth = (1.5D * this.xScale);
/* 414 */     setPreferredSize(new Dimension((int)(750.0F * this.xScale + 100.0F), (int)(100.0F * this.yScale + 25.0F)));
/*     */   }
/*     */ 
/*     */   public void resetZoom()
/*     */   {
/* 421 */     this.yScale = 1.0F;
/* 422 */     this.xScale = 1.0F;
/* 423 */     if (this.noOfDays == 150)
/* 424 */       this.stickWidth = (4.0F * this.xScale);
/*     */     else
/* 426 */       this.stickWidth = (1.5D * this.xScale);
/* 427 */     setPreferredSize(new Dimension((int)(750.0F * this.xScale + 100.0F), (int)(100.0F * this.yScale + 25.0F)));
/*     */   }
/*     */ 
/*     */   protected void clear(Graphics paramGraphics)
/*     */   {
/* 434 */     super.paintComponent(paramGraphics);
/*     */   }
/*     */ 
/*     */   protected void paintComponent(Graphics paramGraphics)
/*     */   {
/* 441 */     clear(paramGraphics);
/* 442 */     Graphics2D localGraphics2D = (Graphics2D)paramGraphics;
/* 443 */     drawChart(localGraphics2D);
/* 444 */     drawValues(localGraphics2D);
/*     */   }
/*     */ 
/*     */   private void drawChart(Graphics2D paramGraphics2D)
/*     */   {
/* 472 */     this.refY = 10.0D;
/* 473 */     this.refX = 50.0D;
/* 474 */     setFont(this.ssp10);
/* 475 */     String str = "William's %R";
/* 476 */     paramGraphics2D.setPaint(new Color(100, 240, 250));
/* 477 */     paramGraphics2D.drawString(str, 50, 10);
/*     */ 
/* 479 */     str = "WMS[" + this.parm1 + "]";
/* 480 */     paramGraphics2D.setPaint(new Color(80, 150, 125));
/* 481 */     paramGraphics2D.drawString(str, 125, 10);
/*     */ 
/* 484 */     this.refL1.setLine(50.0D, 10.0D, 50.0D, this.yScale * 100.0F + 10.0F);
/* 485 */     this.refL2.setLine(750.0F * this.xScale + 50.0F, 10.0D, 750.0F * this.xScale + 50.0F, this.yScale * 100.0F + 10.0F);
/* 486 */     paramGraphics2D.setPaint(Color.white);
/* 487 */     paramGraphics2D.draw(this.refL1);
/* 488 */     paramGraphics2D.draw(this.refL2);
/*     */ 
/* 490 */     for (int i = 0; i < 14; i++)
/*     */     {
/* 492 */       this.refX += 50.0F * this.xScale;
/* 493 */       this.gridY.setLine(this.refX, 10.0D, this.refX, this.yScale * 100.0F + 10.0F);
/* 494 */       paramGraphics2D.setPaint(Color.darkGray);
/* 495 */       paramGraphics2D.draw(this.gridY);
/*     */     }
int i;
/*     */ 
/* 499 */     for (i = 0; i < 11; i++)
/*     */     {
/* 501 */       this.yrefL1.setLine(50.0D, this.refY, 40.0D, this.refY);
/* 502 */       str = "" + (int)(this.maxVal - (this.maxVal - this.minVal) / 10.0F * i);
/* 503 */       paramGraphics2D.setPaint(Color.lightGray);
/* 504 */       paramGraphics2D.drawString(str, 30, (int)this.refY);
/* 505 */       this.yrefL2.setLine(750.0F * this.xScale + 50.0F, this.refY, 750.0F * this.xScale + 60.0F, this.refY);
/*     */ 
/* 507 */       paramGraphics2D.drawString(str, (int)(750.0F * this.xScale + 53.0F), (int)this.refY);
/* 508 */       this.gridX.setLine(50.0D, this.refY, 750.0F * this.xScale + 50.0F, this.refY);
/* 509 */       paramGraphics2D.setPaint(Color.white);
/* 510 */       paramGraphics2D.draw(this.yrefL1);
/* 511 */       paramGraphics2D.draw(this.yrefL2);
/* 512 */       if ((i == 2) || (i == 8))
/* 513 */         paramGraphics2D.setPaint(new Color(120, 120, 0));
/*     */       else
/* 515 */         paramGraphics2D.setPaint(Color.darkGray);
/* 516 */       paramGraphics2D.draw(this.gridX);
/* 517 */       this.refY += 10.0F * this.yScale;
/*     */     }
/*     */ 
/* 521 */     this.yfactor = (this.yScale * 100.0F / (this.maxVal - this.minVal));
/* 522 */     this.startPointX = (750.0F * this.xScale + 50.0F - (this.stickWidth + 1.0F * this.xScale));
/* 523 */     this.dateRef = (this.sq.count - 1);
/* 524 */     this.daysRef = 1;
/*     */ 
/* 527 */     for (i = this.sq.count - 1; i > this.parm1; i--)
/*     */     {
/* 529 */       if (this.daysRef == this.noOfDays)
/*     */         break;
/* 531 */       paramGraphics2D.setFont(this.ssp10);
/*     */ 
/* 533 */       if (i > this.parm1)
/*     */       {
/* 535 */         this.p1Y = (this.yScale * 100.0F + 10.0F - (this.wr_parm1[i] - this.minVal) * this.yfactor);
/* 536 */         this.p2Y = (this.yScale * 100.0F + 10.0F - (this.wr_parm1[(i - 1)] - this.minVal) * this.yfactor);
/*     */ 
/* 538 */         this.l2.setLine(this.startPointX, this.p1Y, this.startPointX - this.stickWidth - 1.0F * this.xScale, this.p2Y);
/* 539 */         paramGraphics2D.setPaint(new Color(80, 150, 125));
/* 540 */         paramGraphics2D.draw(this.l2);
/*     */       }
/*     */ 
/* 545 */       if (this.wr_parm1[i] > -20.0F) {
/* 546 */         this.trend = "Bullish";
/*     */       }
/* 548 */       if (this.wr_parm1[i] < -80.0F) {
/* 549 */         this.trend = "Bearish";
/*     */       }
/* 551 */       if ((this.wr_parm1[i] >= -80.0F) && (this.wr_parm1[i] <= -20.0F))
/*     */       {
/* 553 */         for (int j = i - 1; j > 10; j--)
/*     */         {
/* 555 */           if (this.wr_parm1[j] < -80.0F)
/*     */           {
/* 557 */             this.trend = "Bullish";
/* 558 */             break;
/*     */           }
/*     */ 
/* 561 */           if (this.wr_parm1[j] <= -20.0F)
/*     */             continue;
/* 563 */           this.trend = "Bearish";
/* 564 */           break;
/*     */         }
/*     */ 
/*     */       }
/*     */ 
/* 570 */       if (this.dateRef == i)
/*     */       {
/* 572 */         paramGraphics2D.setFont(this.ssp9);
/* 573 */         str = ((String)this.sq.date.get(i)).substring(0, 6);
/* 574 */         if (this.trend == "Bullish")
/* 575 */           paramGraphics2D.setPaint(Color.green);
/*     */         else {
/* 577 */           paramGraphics2D.setPaint(Color.red);
/*     */         }
/* 579 */         paramGraphics2D.drawString(str, (int)this.startPointX, (int)(this.yScale * 100.0F + 20.0F));
/* 580 */         if (this.noOfDays == 150)
/* 581 */           this.dateRef -= 10;
/*     */         else
/* 583 */           this.dateRef -= 20;
/* 584 */         paramGraphics2D.setFont(this.ssp10);
/*     */ 
/* 586 */         if (this.c == true)
/*     */         {
/* 588 */           this.c = false;
/*     */         }
/*     */ 
/*     */       }
/*     */ 
/* 594 */       this.startPointX = (this.startPointX - this.stickWidth - 1.0F * this.xScale);
/* 595 */       this.daysRef += 1;
/*     */     }
/*     */   }
/*     */ 
/*     */   private void findTrend()
/*     */   {
/* 604 */     if (this.wr_parm1[(this.sq.count - 1)] > -20.0F) {
/* 605 */       this.trend = "Bullish";
/* 606 */       return;
/*     */     }
/*     */ 
/* 609 */     if (this.wr_parm1[(this.sq.count - 1)] < -80.0F) {
/* 610 */       this.trend = "Bearish";
/* 611 */       return;
/*     */     }
/*     */ 
/* 614 */     if ((this.wr_parm1[(this.sq.count - 1)] >= -80.0F) && (this.wr_parm1[(this.sq.count - 1)] <= -20.0F))
/*     */     {
/* 616 */       for (int i = this.sq.count - 2; i > 10; i--)
/*     */       {
/* 618 */         if (this.wr_parm1[i] < -80.0F)
/*     */         {
/* 620 */           this.trend = "Bullish";
/* 621 */           return;
/*     */         }
/*     */ 
/* 624 */         if (this.wr_parm1[i] <= -20.0F)
/*     */           continue;
/* 626 */         this.trend = "Bearish";
/* 627 */         return;
/*     */       }
/*     */     }
/*     */   }
/*     */ 
/*     */   public static void main(String[] paramArrayOfString)
/*     */   {
/* 693 */     FileDownloader localFileDownloader = new FileDownloader();
/* 694 */     localFileDownloader.downloadFiles();
/* 695 */     SymQuotes localSymQuotes = new SymQuotes("WIPRO", localFileDownloader.datesToRead, 1, 1, "ns");
/*     */ 
/* 697 */     WRChart localWRChart = new WRChart(localSymQuotes, 10);
/*     */ 
/* 699 */     JFrame localJFrame = new JFrame("Test");
/* 700 */     localJFrame.setDefaultCloseOperation(3);
/* 701 */     localJFrame.getContentPane().add(localWRChart);
/* 702 */     localJFrame.pack();
/* 703 */     localJFrame.setSize(850, 175);
/* 704 */     localJFrame.setVisible(true);
/*     */   }
/*     */ 
/*     */   public class EastPanel extends JPanel
/*     */   {
/*     */     private JLabel title;
/*     */     private JLabel wrL;
/*     */     private JLabel l1;
/*     */     private JLabel l2;
/*     */     private JLabel trendL;
/*     */     private ChartHelpButton chb;
/* 640 */     private Font valuesF = new Font("Sanserif", 0, 11);
/* 641 */     public Box buttonsPanel = Box.createHorizontalBox();
/*     */ 
/*     */     public EastPanel()
/*     */     {
/* 645 */       this.title = new JLabel("William's %R");
/* 646 */       this.wrL = new JLabel("WMS[" + WRChart.this.parm1 + "]: " + WRChart.this.df.format(WRChart.this.wr_parm1[(WRChart.this.sq.count - 1)]));
/* 647 */       this.l1 = new JLabel("Overbought:WMS > -20");
/* 648 */       this.l2 = new JLabel("Oversold:WMS < -80");
/*     */ 
/* 650 */       this.trendL = new JLabel("Trend: " + WRChart.this.trend);
/* 651 */       this.chb = new ChartHelpButton("http://www.profitindicators.com/home/indicators/wms.htm", "Help on William's %R");
/*     */ 
/* 653 */       this.chb.setFont(this.valuesF);
/*     */ 
/* 655 */       this.wrL.setFont(this.valuesF);
/* 656 */       this.trendL.setFont(this.valuesF);
/* 657 */       this.l1.setFont(this.valuesF);
/* 658 */       this.l2.setFont(this.valuesF);
/*     */ 
/* 660 */       this.buttonsPanel.add(this.chb);
/* 661 */       this.buttonsPanel.add(Box.createHorizontalStrut(2));
/* 662 */       this.buttonsPanel.setAlignmentX(0.0F);
/*     */ 
/* 664 */       setLayout(new BoxLayout(this, 3));
/*     */ 
/* 666 */       add(this.title);
/* 667 */       add(this.wrL);
/* 668 */       add(new JLabel(" "));
/* 669 */       add(this.trendL);
/* 670 */       add(this.l1);
/* 671 */       add(this.l2);
/* 672 */       add(this.buttonsPanel);
/* 673 */       add(Box.createVerticalGlue());
/*     */ 
/* 675 */       setBackground(new Color(243, 245, 252));
/*     */     }
/*     */ 
/*     */     public void updateValues()
/*     */     {
/* 682 */       this.wrL.setText("WMS[" + WRChart.this.parm1 + "]: " + WRChart.this.df.format(WRChart.this.wr_parm1[(WRChart.this.sq.count - 1)]));
/* 683 */       this.trendL.setText("Trend: " + WRChart.this.trend);
/*     */     }
/*     */   }
/*     */ }

/* Location:           C:\Users\Deebak\Downloads\profitindicatorsv2-05.jar
 * Qualified Name:     WRChart
 * JD-Core Version:    0.6.0
 */